function test(){
    var elem = document.getElementById("name");
    if(elem.value == ""){
        alert("name can not be empty");
        return false;
    }else{
        alert("name: " + elem.value);
    }
}